import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
import _isString from "lodash/isString";
import _isObject from "lodash/isObject";
import _isNumber from "lodash/isNumber";
import _isFunction from "lodash/isFunction";
import _isEmpty from "lodash/isEmpty";
import _isArray from "lodash/isArray";
var _excluded = ["shieldFlag"];

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _dec28, _dec29, _dec30, _dec31, _dec32, _dec33, _dec34, _dec35, _dec36, _dec37, _dec38, _dec39, _dec40, _class, _class2;

/**
 * RoleManagement - 角色管理
 * @date: 2018-7-4

 */
import React from 'react';
import { Spin, Form } from 'antd';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { stringify } from 'qs';
import { Bind } from 'lodash-decorators';
import { Content, Header } from 'components/Page';
import { deleteCache } from 'components/CacheComponent';
import { Button as ButtonPermission } from 'components/Permission';
import Lov from 'components/Lov';
import uuidv4 from 'uuid/v4';
import notification from 'utils/notification';
import formatterCollections from 'utils/intl/formatterCollections';
import intl from 'utils/intl';
import { createPagination, getCurrentOrganizationId, isTenantRoleLevel, addItemToPagination, delItemToPagination // getCurrentUser,
} from 'utils/utils';
import AssignMember from "./AssignMember";
import AssignSecGrpDrawer from "./AssignSecGrp";
import ClientsDrawer from "./Clients";
import Search from "./Search";
import List from "./List";
import AuthDrawer from "./Auth";
import DetailDrawer from "./Detail";
import PermissionDrawer from "./Permissions";
import RoleAssignCardsEditModal from "./Cards";
import styles from "./index.less?modules";

function isJSON(str) {
  var result;

  try {
    result = JSON.parse(str);
  } catch (e) {
    return false;
  }

  return _isObject(result) && !_isString(result);
}

var formLayout = {
  labelCol: {
    span: 10
  },
  wrapperCol: {
    span: 14
  }
};
/**
 * index - 角色管理
 * @extends {Component} - React.Component
 * @reactProps {Object} [location={}] - 当前路由信息
 * @reactProps {Object} [match={}] - react-router match路由信息
 * @reactProps {!Object} roleManagement - 数据源
 * @reactProps {!Object} loading - 数据加载是否完成
 * @reactProps {Object} form - 表单对象
 * @reactProps {Function} [dispatch=function(e) {return e;}] - redux dispatch方法
 * @return React.element
 */

var RoleManagement = (_dec = connect(function (_ref) {
  var _ref$loading = _ref.loading,
      loading = _ref$loading === void 0 ? {} : _ref$loading,
      roleManagement = _ref.roleManagement,
      roleDataAuthorityCompany = _ref.roleDataAuthorityCompany,
      roleDataAuthorityPurorg = _ref.roleDataAuthorityPurorg,
      roleDataAuthorityManagement = _ref.roleDataAuthorityManagement,
      roleDataAuthorityPuragent = _ref.roleDataAuthorityPuragent,
      roleDataAuthorityLovView = _ref.roleDataAuthorityLovView,
      roleDataAuthorityDataSource = _ref.roleDataAuthorityDataSource,
      roleDataAuthorityValueList = _ref.roleDataAuthorityValueList,
      roleDataAuthorityDataGroup = _ref.roleDataAuthorityDataGroup;
  return {
    roleManagement: roleManagement,
    roleDataAuthorityCompany: roleDataAuthorityCompany,
    roleDataAuthorityPurorg: roleDataAuthorityPurorg,
    roleDataAuthorityManagement: roleDataAuthorityManagement,
    roleDataAuthorityPuragent: roleDataAuthorityPuragent,
    roleDataAuthorityLovView: roleDataAuthorityLovView,
    roleDataAuthorityDataSource: roleDataAuthorityDataSource,
    roleDataAuthorityValueList: roleDataAuthorityValueList,
    roleDataAuthorityDataGroup: roleDataAuthorityDataGroup,
    queryListLoading: loading.effects['roleManagement/queryList'],
    saveMembersLoading: loading.effects['roleManagement/saveMembers'],
    deleteMembersLoading: loading.effects['roleManagement/deleteMembers'],
    queryMemberRolesUsersLoading: loading.effects['roleManagement/queryMemberRolesUsers'],
    queryDetailFormLoading: loading.effects['roleManagement/queryDetailForm'],
    queryAdminRoleLoading: loading.effects['roleManagement/queryAdminRole'],
    saveRoleLoading: loading.effects['roleManagement/saveRole'],
    queryMemberRolesClientsLoading: loading.effects['roleManagement/queryMemberRolesClients'],
    createRoleLoading: loading.effects['roleManagement/createRole'],
    copyRoleLoading: loading.effects['roleManagement/copyRole'],
    inheritRoleLoading: loading.effects['roleManagement/inheritRole'],
    queryPermissionMenusLoading: loading.effects['roleManagement/queryPermissionMenus'],
    batchAssignPermissionSetsLoading: loading.effects['roleManagement/batchAssignPermissionSets'],
    batchUnassignPermissionSetsLoading: loading.effects['roleManagement/batchUnassignPermissionSets'],
    fetchRoleCardsLoading: loading.effects['roleManagement/fetchRoleCards'],
    removeRoleCardsLoading: loading.effects['roleManagement/removeRoleCards'],
    saveRoleCardsLoading: loading.effects['roleManagement/saveRoleCards'],
    tenantRoleLevel: isTenantRoleLevel(),
    roleAuthLoading: loading.effects['roleManagement/queryRoleAuth'],
    saveAuthLoading: loading.effects['roleManagement/saveRoleAuth'],
    fetchTabListLoading: loading.effects['roleDataAuthorityManagement/fetchTabList'],
    updateCompanyLoading: loading.effects['roleDataAuthorityCompany/updateAuthorityCompany'],
    fetchCompanyLoading: loading.effects['roleDataAuthorityCompany/fetchAuthorityCompanyAndExpand'],
    refreshCompanyLoading: loading.effects['roleDataAuthorityCompany/fetchAuthorityCompany'],
    addPurOrgLoading: loading.effects['roleDataAuthorityPurorg/addAuthorityPurorg'],
    fetchPurOrgLoading: loading.effects['roleDataAuthorityPurorg/fetchAuthorityPurorg'],
    fetchModalPurOrgLoading: loading.effects['roleDataAuthorityPurorg/fetchModalData'],
    addPuragentLoading: loading.effects['roleDataAuthorityPuragent/addAuthorityPuragent'],
    fetchPuragentLoading: loading.effects['roleDataAuthorityPuragent/fetchAuthorityPuragent'],
    fetchModalPuragentLoading: loading.effects['roleDataAuthorityPuragent/fetchModalData'],
    addValueListLoading: loading.effects['roleDataAuthorityValueList/addAuthorityValueList'],
    fetchValueListLoading: loading.effects['roleDataAuthorityValueList/fetchAuthorityValueList'],
    fetchModalValueListLoading: loading.effects['roleDataAuthorityValueList/fetchModalData'],
    addLovViewLoading: loading.effects['roleDataAuthorityLovView/addAuthorityLovView'],
    fetchLovViewLoading: loading.effects['roleDataAuthorityLovView/fetchAuthorityLovView'],
    fetchModalLovViewLoading: loading.effects['roleDataAuthorityLovView/fetchModalData'],
    addDataSourceLoading: loading.effects['roleDataAuthorityDataSource/addAuthorityDataSource'],
    fetchDataSourceLoading: loading.effects['roleDataAuthorityDataSource/fetchAuthorityDataSource'],
    fetchModalDataSourceLoading: loading.effects['roleDataAuthorityDataSource/fetchModalData'],
    addDataGroupLoading: loading.effects['roleDataAuthorityDataGroup/addAuthorityDataGroup'],
    fetchDataGroupLoading: loading.effects['roleDataAuthorityDataGroup/fetchAuthorityDataGroup'],
    fetchModalDataGroupLoading: loading.effects['roleDataAuthorityDataGroup/fetchModalData'],
    queryRoleCardLoading: loading.effects['roleManagement/queryRoleCard'],
    querySecGrpLoading: loading.effects['roleManagement/querySecurityGroup'],
    queryAssignableSecGrpLoading: loading.effects['roleManagement/fetchAssignableSecGrp'],
    assignSecGrpLoading: loading.effects['roleManagement/assignSecGrp'],
    deleteSecGrpLoading: loading.effects['roleManagement/deleteSecGrp'],
    queryVisitPermissionLoading: loading.effects['roleManagement/querySecGrpPermissionMenus'],
    shieldLoading: loading.effects['roleManagement/shieldSecGrpPermission'] || loading.effects['roleManagement/cancelShieldSecGrpPermission'],
    queryFieldPermissionLoading: loading.effects['roleManagement/queryFieldPermission'],
    queryFieldConfigLoading: loading.effects['roleManagement/queryFieldConfig'],
    queryCardLoading: loading.effects['roleManagement/queryCardPermission'],
    queryDataDimensionLoading: loading.effects['roleManagement/queryDataDimension'],
    queryDataPermissionTabLoading: loading.effects['roleManagement/queryDataPermissionTab']
  };
}), _dec2 = Form.create(), _dec3 = formatterCollections({
  code: ['ciam.roleManagement', 'ciam.authority', 'ciam.securityGroup']
}), _dec4 = Bind(), _dec5 = Bind(), _dec6 = Bind(), _dec7 = Bind(), _dec8 = Bind(), _dec9 = Bind(), _dec10 = Bind(), _dec11 = Bind(), _dec12 = Bind(), _dec13 = Bind(), _dec14 = Bind(), _dec15 = Bind(), _dec16 = Bind(), _dec17 = Bind(), _dec18 = Bind(), _dec19 = Bind(), _dec20 = Bind(), _dec21 = Bind(), _dec22 = Bind(), _dec23 = Bind(), _dec24 = Bind(), _dec25 = Bind(), _dec26 = Bind(), _dec27 = Bind(), _dec28 = Bind(), _dec29 = Bind(), _dec30 = Bind(), _dec31 = Bind(), _dec32 = Bind(), _dec33 = Bind(), _dec34 = Bind(), _dec35 = Bind(), _dec36 = Bind(), _dec37 = Bind(), _dec38 = Bind(), _dec39 = Bind(), _dec40 = Bind(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = /*#__PURE__*/function (_React$Component) {
  _inherits(RoleManagement, _React$Component);

  var _super = _createSuper(RoleManagement);

  function RoleManagement(props) {
    var _this;

    _classCallCheck(this, RoleManagement);

    _this = _super.call(this, props);
    _this.state = {
      membersDrawerVisible: false,
      clientsDrawerVisible: false,
      secGrpDrawerVisible: false,
      // 是否显示分配安全组弹窗
      membersDrawerDataSource: [],
      membersDrawerPagination: {},
      currentRowData: {},
      selectedRoleId: null,
      actionType: null,
      detailDrawerVisible: false,
      permissionDrawerVisible: false,
      currentRole: {},
      expandedRowKeys: [],
      roleAssignCardsEditModalProps: {
        visible: false,
        role: {} // 编辑的角色

      },
      tenantsLoaded: false,
      // 表明已经加载了当前用户的租户
      tenantsMulti: false,
      // 表明是否是 多租户
      tenantId: 0,
      createDisabled: true,
      record: {}
    };
    _this.fetchList = _this.fetchList.bind(_assertThisInitialized(_this));
    _this.fetchRoleSourceCode = _this.fetchRoleSourceCode.bind(_assertThisInitialized(_this));
    _this.fetchAssignLevelCode = _this.fetchAssignLevelCode.bind(_assertThisInitialized(_this));
    _this.fetchMemberRolesUsers = _this.fetchMemberRolesUsers.bind(_assertThisInitialized(_this));
    _this.fetchCurrentRole = _this.fetchCurrentRole.bind(_assertThisInitialized(_this));
    _this.redirectCreate = _this.redirectCreate.bind(_assertThisInitialized(_this));
    _this.setClientsDrawerVisible = _this.setClientsDrawerVisible.bind(_assertThisInitialized(_this));
    _this.openMembersDrawer = _this.openMembersDrawer.bind(_assertThisInitialized(_this));
    _this.openClientsDrawer = _this.openClientsDrawer.bind(_assertThisInitialized(_this));
    _this.openPermissions = _this.openPermissions.bind(_assertThisInitialized(_this));
    return _this;
  }

  _createClass(RoleManagement, [{
    key: "componentDidMount",
    value:
    /**
     * componentDidMount 生命周期函数
     * render后请求页面数据
     */
    function componentDidMount() {
      var _this$props = this.props,
          _this$props$roleManag = _this$props.roleManagement,
          roleManagement = _this$props$roleManag === void 0 ? {} : _this$props$roleManag,
          dispatch = _this$props.dispatch;
      var code = roleManagement.code; //  const currentUser = getCurrentUser();
      //  this.setState({createDisabled: !currentUser.currentRoleAdminFlag,record:{id:currentUser.currentRoleId,name:currentUser.currentRoleName,tenantId:currentUser.tenantId,tenantName:currentUser.tenantName,adminFlag:currentUser.currentRoleAdminFlag,level:currentUser.currentRoleLevel}})

      var isTenant = isTenantRoleLevel();

      if (isTenant) {
        // 查询当前账号的所有租户
        this.fetchCurrentTenants();
      } // this.fetchAssignLevelCode();

      /**
       * 初始化角色层级列表值集
       */


      dispatch({
        type: 'roleManagement/init'
      });
      this.fetchSearchLabels();
      this.fetchCurrentRole(); // if (isEmpty(list.dataSource) || (location.state || {}).refresh) {
      //   this.fetchList();
      // }

      if (_isEmpty(code['CIAM.ROLE_SOURCE'])) {
        this.fetchRoleSourceCode();
      }
    } // #region fetch data

  }, {
    key: "fetchCurrentTenants",
    value: function fetchCurrentTenants() {
      var _this2 = this;

      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/fetchCurrentTenants'
      }).then(function (res) {
        if (res) {
          var nextPartialState = {};
          nextPartialState.tenantsLoaded = true;

          if (res.length > 1) {
            nextPartialState.tenantsMulti = true;
          } else if (res.length === 1) {
            nextPartialState.tenantsMulti = res[0].tenantId !== getCurrentOrganizationId();
          }

          _this2.setState(nextPartialState);
        }
      });
    }
    /**
     * fetchList - 查询列表数据
     * @param {object} [params = {}] - 查询参数
     * @param {string} params.name - 目录/菜单名
     * @param {string} params.parentName - 上级目录
     */

  }, {
    key: "fetchList",
    value: function fetchList(params) {
      var _this3 = this;

      var dispatch = this.props.dispatch;
      var record = this.state.record;
      dispatch({
        type: 'roleManagement/queryList',
        params: _objectSpread(_objectSpread({}, params), {}, {
          adminRoleId: record.id
        })
      }).then(function () {
        var roleManagement = _this3.props.roleManagement;
        var list = roleManagement.list;

        var _ref2 = params || {},
            name = _ref2.name,
            tenantId = _ref2.tenantId,
            roleSource = _ref2.roleSource;

        if (!_isEmpty(name) || !_isEmpty(roleSource) || _isNumber(tenantId)) {
          _this3.setState({
            expandedRowKeys: list.rowKeys || []
          });
        }
      });
    }
    /**
     * fetchRoleSourceCode - 查询角色来源值集
     */

  }, {
    key: "fetchRoleSourceCode",
    value: function fetchRoleSourceCode() {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/queryCode',
        payload: {
          lovCode: 'CIAM.ROLE_SOURCE'
        }
      });
    }
    /**
     * 查询搜索字段 标签 数据
     */

  }, {
    key: "fetchSearchLabels",
    value: function fetchSearchLabels() {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/querySearchLabels',
        payload: {
          type: 'ROLE'
        }
      });
    }
    /**
     * fetchRoleSourceCode - 查询层级值集
     */

  }, {
    key: "fetchAssignLevelCode",
    value: function fetchAssignLevelCode() {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryCode',
        payload: {
          lovCode: 'CIAM.RESOURCE_LEVEL'
        }
      });
    }
    /**
     * fetchHrunitsTree - 查询组织
     * @param {!number} organizationId - 租户ID
     * @param {object} payload - 查询参数
     * @param {!number} payload.userId - 用户ID
     */

  }, {
    key: "fetchHrunitsTree",
    value: function fetchHrunitsTree(organizationId, payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryHrunitsTree',
        organizationId: organizationId,
        payload: payload
      });
    }
    /**
     * fetchMemberRolesUsers - 查询角色成员
     * @param {object} payload - 查询参数
     * @param {!number} payload.roleId - 用户ID
     * @param {!number} [payload.size=10] - 分页数目
     * @param {!number} [payload.page=0] - 当前页
     */

  }, {
    key: "fetchMemberRolesUsers",
    value: function fetchMemberRolesUsers(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryMemberRolesUsers',
        payload: payload
      });
    }
  }, {
    key: "fetchDetailForm",
    value: function fetchDetailForm(roleId) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryDetailForm',
        roleId: roleId
      });
    }
  }, {
    key: "fetchAdminRole",
    value: function fetchAdminRole(roleId) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryAdminRole',
        payload: {
          roleId: roleId
        }
      });
    }
  }, {
    key: "fetchPermissionMenus",
    value: function fetchPermissionMenus(roleId) {
      var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryPermissionMenus',
        roleId: roleId,
        params: params
      });
    }
  }, {
    key: "fetchCurrentRole",
    value: function fetchCurrentRole() {
      var _this4 = this;

      var _this$props2 = this.props,
          _this$props2$roleMana = _this$props2.roleManagement,
          roleManagement = _this$props2$roleMana === void 0 ? {} : _this$props2$roleMana,
          _this$props2$location = _this$props2.location,
          location = _this$props2$location === void 0 ? {} : _this$props2$location,
          dispatch = _this$props2.dispatch;
      var _roleManagement$list = roleManagement.list,
          list = _roleManagement$list === void 0 ? {} : _roleManagement$list;
      return dispatch({
        type: 'roleManagement/queryCurrentRole'
      }).then(function (res) {
        if (res) {
          _this4.setState({
            currentRole: res,
            record: res,
            createDisabled: !res.adminFlag
          });
        }

        if (_isEmpty(list.dataSource) || (location.state || {}).refresh) {
          _this4.fetchList();
        }
      });
    } // #endregion
    // #region update data

  }, {
    key: "saveRoleDetail",
    value: function saveRoleDetail(roleId, data) {
      var _this5 = this;

      var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (e) {
        return e;
      };
      var _this$props3 = this.props,
          dispatch = _this$props3.dispatch,
          list = _this$props3.roleManagement.list;
      var _this$queryForm$getFi = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi;
      return dispatch({
        type: 'roleManagement/saveRole',
        roleId: roleId,
        data: data
      }).then(function (res) {
        if (res) {
          notification.success({
            message: intl.get("cpaas.common.notification.success.save").d('保存成功')
          });

          _this5.fetchList(_objectSpread({
            page: list.pagination
          }, getFieldsValue()));

          cb();
        }
      });
    }
  }, {
    key: "createRole",
    value: function createRole(data) {
      var _this6 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      var _this$queryForm$getFi2 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi2 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi2;
      return dispatch({
        type: 'roleManagement/createRole',
        data: data
      }).then(function (res) {
        if (res) {
          notification.success({
            message: intl.get("cpaas.common.notification.success.create").d('创建成功')
          });

          _this6.fetchList(getFieldsValue());

          cb();
        }
      });
    }
  }, {
    key: "copyRole",
    value: function copyRole(data) {
      var _this7 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var _this$props4 = this.props,
          dispatch = _this$props4.dispatch,
          list = _this$props4.roleManagement.list;
      var _this$queryForm$getFi3 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi3 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi3;
      return dispatch({
        type: 'roleManagement/copyRole',
        data: data
      }).then(function (res) {
        if (res) {
          notification.success({
            message: intl.get("cpaas.common.notification.success.create").d('创建成功')
          });

          _this7.fetchList(_objectSpread({
            page: list.pagination
          }, getFieldsValue()));

          cb();
        }
      });
    }
  }, {
    key: "inheritRole",
    value: function inheritRole(data) {
      var _this8 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var _this$props5 = this.props,
          dispatch = _this$props5.dispatch,
          list = _this$props5.roleManagement.list;
      var _this$queryForm$getFi4 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi4 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi4;
      return dispatch({
        type: 'roleManagement/inheritRole',
        data: data
      }).then(function (res) {
        if (res) {
          notification.success({
            message: intl.get("cpaas.common.notification.success.create").d('创建成功')
          });

          _this8.fetchList(_objectSpread({
            page: list.pagination
          }, getFieldsValue()));

          cb();
        }
      });
    }
  }, {
    key: "queryLabel",
    value: function queryLabel(data) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryRoleLabel',
        payload: data
      });
    }
  }, {
    key: "batchUnassignPermissionSets",
    value: function batchUnassignPermissionSets(roleId, data) {
      var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/batchUnassignPermissionSets',
        roleId: roleId,
        data: data
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();
        }
      });
    }
  }, {
    key: "batchAssignPermissionSets",
    value: function batchAssignPermissionSets(roleId, data) {
      var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/batchAssignPermissionSets',
        roleId: roleId,
        data: data
      }).then(function (res) {
        if (res && res.failed) {
          notification.error({
            description: res.message
          });
        } else {
          notification.success();
          cb();
        }
      });
    } // #endregion

    /**
     * onExpand - 展开树
     * @param {boolean} expanded - 是否展开
     * @param {record} record - 当前行数据
     */

  }, {
    key: "onExpand",
    value: function onExpand(expanded, record) {
      var expandedRowKeys = this.state.expandedRowKeys;
      this.setState({
        expandedRowKeys: expanded ? expandedRowKeys.concat(record.id) : expandedRowKeys.filter(function (o) {
          return o !== record.id;
        })
      });
    }
    /**
     * openMembersDrawer - 打开分配用户抽屉
     * @param {object} [role={}] - 当前行数据
     */

  }, {
    key: "openMembersDrawer",
    value: function openMembersDrawer(role) {
      this.setState({
        currentRowData: role,
        membersDrawerVisible: true
      });
    }
    /**
     * 打开分配模态框
     * @param {*} role
     */

  }, {
    key: "openClientsDrawer",
    value: function openClientsDrawer(role) {
      var _this$props6 = this.props,
          dispatch = _this$props6.dispatch,
          _this$props6$roleMana = _this$props6.roleManagement.clientPagination,
          clientPagination = _this$props6$roleMana === void 0 ? {} : _this$props6$roleMana;
      this.setState({
        currentRowData: role
      });
      dispatch({
        type: 'roleManagement/queryMemberRolesClients',
        payload: {
          roleId: role.id,
          page: clientPagination
        }
      });
      this.setClientsDrawerVisible(true);
    }
    /**
     * closeMembersDrawer - 关闭分配用户抽屉
     */

  }, {
    key: "closeMembersDrawer",
    value: function closeMembersDrawer() {
      var _this9 = this;

      this.setState({
        membersDrawerVisible: false
      }, function () {
        _this9.setState({
          currentRowData: {}
        });
      });
    }
    /**
     * onCancel方法关闭分配客户端模态框 并清除缓存
     */

  }, {
    key: "closeClientsDrawer",
    value: function closeClientsDrawer() {
      var dispatch = this.props.dispatch;
      this.setState({
        currentRowData: {}
      });
      this.setClientsDrawerVisible(false);
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          clientList: []
        }
      });
    } // #region no used

    /**
     * redirectCreate - 跳转创建角色页面
     * @param {object} [params={}] - 查询参数
     * @param {number} params.copy_from - 复制并创建角色ID
     * @param {number} params.inherit_from - 继承自角色ID
     * @param {string} params.name - 继承自角色名称
     */

  }, {
    key: "redirectCreate",
    value: function redirectCreate() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var dispatch = this.props.dispatch;
      dispatch(routerRedux.push({
        pathname: '/ciam/role/create',
        search: stringify(params)
      }));
    }
    /**
     * redirectEdit - 跳转编辑角色页面
     * @param {number} id - 角色ID
     */

  }, {
    key: "redirectEdit",
    value: function redirectEdit(id) {
      var dispatch = this.props.dispatch;
      dispatch(routerRedux.push({
        pathname: "/ciam/role/edit-detail/".concat(id)
      }));
    }
    /**
     * redirectView - 跳转查看角色页面
     * @param {number} id - 角色ID
     */

  }, {
    key: "redirectView",
    value: function redirectView(id) {
      var dispatch = this.props.dispatch;
      dispatch(routerRedux.push({
        pathname: "/ciam/role/detail/".concat(id)
      }));
    } // #endregion

    /**
     * 分配客户端模态框开关控制
     * @param {*} clientsDrawerVisible
     */

  }, {
    key: "setClientsDrawerVisible",
    value: function setClientsDrawerVisible() {
      var clientsDrawerVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      var dispatch = this.props.dispatch;
      this.setState({
        clientsDrawerVisible: clientsDrawerVisible
      });
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          clientList: []
        }
      });
    }
    /**
     * setMembersDrawerDataSource - 设置分配用户表格数据
     * @param {Array} [dataSource=[]] - 数据源
     * @param {object} [pagination={}] - 分页
     * @param {!number} [pagination.size=10] - 分页数目
     * @param {!number} [pagination.page=0] - 当前页
     */

  }, {
    key: "setMembersDrawerDataSource",
    value: function setMembersDrawerDataSource() {
      var dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var pagination = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var membersDrawerPagination = this.state.membersDrawerPagination;
      this.setState({
        membersDrawerDataSource: dataSource,
        membersDrawerPagination: _isEmpty(pagination) ? createPagination({
          number: membersDrawerPagination.current - 1,
          size: dataSource.length > membersDrawerPagination.pageSize ? dataSource.length : membersDrawerPagination.pageSize,
          totalElements: dataSource.length
        }) : pagination
      });
    }
    /**
     * exportList - 导出
     */

  }, {
    key: "exportList",
    value: function exportList() {}
    /**
     * expandAll - 全部展开
     */

  }, {
    key: "expandAll",
    value: function expandAll() {
      var _this$props$roleManag2 = this.props.roleManagement,
          roleManagement = _this$props$roleManag2 === void 0 ? {} : _this$props$roleManag2;
      var list = roleManagement.list;
      this.setState({
        expandedRowKeys: list.rowKeys || []
      });
    }
    /**
     * expandAll - 全部收起
     */

  }, {
    key: "collapseAll",
    value: function collapseAll() {
      this.setState({
        expandedRowKeys: []
      });
    }
  }, {
    key: "closeDetail",
    value: function closeDetail() {
      this.setState({
        actionType: null,
        currentRowData: {},
        detailDrawerVisible: false
      });
    }
  }, {
    key: "openPermissions",
    value: function openPermissions(record) {
      this.setState({
        permissionDrawerVisible: true,
        currentRowData: record
      });
    }
  }, {
    key: "closePermission",
    value: function closePermission() {
      this.setState({
        permissionDrawerVisible: false,
        currentRowData: {}
      });
    }
    /**
     * handleAction - 表格按钮事件函数
     * @param {!string} action - 事件类型
     * @param {!object} record - 当前行数据
     */

  }, {
    key: "handleAction",
    value: function handleAction(action, record, isTree) {
      var _this10 = this;

      var _this$props7 = this.props,
          _this$props7$dispatch = _this$props7.dispatch,
          dispatch = _this$props7$dispatch === void 0 ? function (e) {
        return e;
      } : _this$props7$dispatch,
          list = _this$props7.roleManagement.list;
      var currentRecord = this.state.record;
      var _this$queryForm$getFi5 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi5 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi5;

      var openDetail = function openDetail(actionType) {
        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

        if (!_isEmpty(actionType)) {
          dispatch({
            type: 'roleManagement/queryLabelList',
            payload: {
              level: record.level === 'site' ? 'SITE' : 'TENANT',
              type: 'ROLE'
            }
          });

          _this10.setState(_objectSpread({
            actionType: actionType,
            currentRowData: // eslint-disable-next-line no-nested-ternary
            actionType === 'create' || actionType === 'copy' || actionType === 'inherit' ? _objectSpread(_objectSpread({}, record), {}, {
              name: isTree ? record.name : currentRecord.name
            }) : actionType === 'edit' ? record : {},
            detailDrawerVisible: true
          }, options));
        }
      };

      var defaultAction = {
        create: function create() {
          // this.redirectEdit(record.id);
          openDetail('create');
        },
        edit: function edit() {
          // this.redirectEdit(record.id);
          openDetail('edit');
        },
        enabled: function enabled() {
          dispatch({
            type: 'roleManagement/setRoleEnabled',
            payload: {
              id: record.id,
              _token: record._token,
              status: !record.enabled
            }
          }).then(function (res) {
            var parseResult = isJSON(res) ? JSON.parse(res) : res;

            if (parseResult.failed) {
              notification.error({
                description: parseResult.message
              });
            } else {
              notification.success();

              _this10.fetchList(_objectSpread(_objectSpread({}, getFieldsValue()), {}, {
                page: list.pagination
              }));
            }
          });
        },
        copy: function copy() {
          // this.redirectCreate({ copy_from: record.id });
          openDetail('copy', {
            copyFormId: record.id
          });
        },
        inherit: function inherit() {
          // this.redirectCreate({ inherit_from: record.id, name: record.name });
          openDetail('inherit', {
            inheritFormId: record.id,
            inheritedRoleName: record.name
          });
        },
        editPermission: function editPermission() {
          _this10.showModal(record);
        },
        editMembers: function editMembers() {
          _this10.openMembersDrawer(record);
        },
        editClients: function editClients() {
          _this10.openClientsDrawer(record);
        },
        assignPermissions: function assignPermissions() {
          _this10.openPermissions(record);
        },
        assignCards: function assignCards() {
          _this10.openRoleAssignCardsEditModal(record);
        },
        editFieldPermission: function editFieldPermission() {
          _this10.gotoFieldPermission(record);
        },
        editSecurityGroup: function editSecurityGroup() {
          _this10.openSecurityGroupDrawer(record);
        }
      };

      if (defaultAction[action]) {
        defaultAction[action]();
      }
    }
    /**
     * handleQueryMembers - 查询角色成员钩子函数
     * @param {object} params - 查询参数
     * @param {!number} params.roleId - 用户ID
     * @param {!number} [params.size=10] - 分页数目
     * @param {!number} [params.page=0] - 当前页
     */

  }, {
    key: "handleQueryMembers",
    value: function handleQueryMembers() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var currentRowData = this.state.currentRowData;
      return this.fetchMemberRolesUsers(_objectSpread({
        roleId: currentRowData.id
      }, params));
    }
    /**
     * 查询分配客户端列表
     * @param {*} params
     */

  }, {
    key: "handleQueryClients",
    value: function handleQueryClients() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var currentRowData = this.state.currentRowData;
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/queryMemberRolesClients',
        payload: _objectSpread({
          roleId: currentRowData.id
        }, params)
      });
    }
    /**
     * 显示分配安全组侧滑
     * @param {object} role - 角色管理列表当前行数据
     */

  }, {
    key: "openSecurityGroupDrawer",
    value: function openSecurityGroupDrawer(role) {
      var _this$props8 = this.props,
          dispatch = _this$props8.dispatch,
          _this$props8$roleMana = _this$props8.roleManagement.secGrpPagination,
          secGrpPagination = _this$props8$roleMana === void 0 ? {} : _this$props8$roleMana;
      this.setState({
        currentRowData: role
      });
      dispatch({
        type: 'roleManagement/querySecurityGroup',
        payload: {
          roleId: role.id,
          page: secGrpPagination
        }
      });
      this.setSecurityGroupDrawerVisible(true);
    }
    /**
     * 关闭安全组侧滑
     */

  }, {
    key: "closeSecGrpDrawer",
    value: function closeSecGrpDrawer(callBack) {
      this.setSecurityGroupDrawerVisible(false, callBack);
      this.resetSecGrp();
    }
    /**
     * 分配安全组侧滑开关控制
     * @param {boolean} secGrpDrawerVisible - 是否显示
     * @param {function} cd - 回调函数
     */

  }, {
    key: "setSecurityGroupDrawerVisible",
    value: function setSecurityGroupDrawerVisible() {
      var secGrpDrawerVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      this.setState({
        secGrpDrawerVisible: secGrpDrawerVisible
      }, function () {
        cb();
      });
    }
    /**
     * 查询分配安全组列表
     * @param {object} params - 查询参数
     */

  }, {
    key: "handleQuerySecGrps",
    value: function handleQuerySecGrps() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var currentRowData = this.state.currentRowData;
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/querySecurityGroup',
        payload: _objectSpread({
          roleId: currentRowData.id
        }, params)
      });
    }
    /**
     * 分配安全组查询表单
     * @param {object} fieldsValue - 查询条件
     */

  }, {
    key: "handleSecGrpSearch",
    value: function handleSecGrpSearch(fieldsValue) {
      this.handleQuerySecGrps(fieldsValue);
    }
    /**
     * 分配安全组分页切换
     * @param {object} pagination - 分页
     * @param {object} fieldsValue - 表单查询条件
     */

  }, {
    key: "handleSecGrpPageChange",
    value: function handleSecGrpPageChange() {
      var pagination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var fieldsValue = arguments.length > 1 ? arguments[1] : undefined;
      // 分配客户端分页切换
      this.handleQuerySecGrps(_objectSpread({
        page: pagination
      }, fieldsValue));
    }
    /**
     * 查询可分配的安全组
     * @param {object} params - 查询参数
     */

  }, {
    key: "fetchAssignableSecGrp",
    value: function fetchAssignableSecGrp() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var currentRowData = this.state.currentRowData;
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/fetchAssignableSecGrp',
        payload: _objectSpread({
          roleId: currentRowData.id
        }, params)
      });
    }
    /**
     * 角色分配安全组
     * @param {array} secGrpList - 选中的安全组
     * @param {function} cb - 回调函数
     */

  }, {
    key: "handleAssignSecGrp",
    value: function handleAssignSecGrp(secGrpList) {
      var _this11 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
      var currentRowData = this.state.currentRowData;
      var dispatch = this.props.dispatch;
      var list = secGrpList.map(function (item) {
        return item.secGrpId;
      });
      return dispatch({
        type: 'roleManagement/assignSecGrp',
        roleId: currentRowData.id,
        secGrpList: list
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();

          _this11.handleQuerySecGrps();
        }
      });
    }
    /**
     * 角色取消分配安全组
     * @param {array} selectedRows - 选中的安全组集合
     */

  }, {
    key: "handleDeleteSecGrp",
    value: function handleDeleteSecGrp(selectedRows) {
      var currentRowData = this.state.currentRowData;
      var dispatch = this.props.dispatch;
      var list = selectedRows.map(function (item) {
        return item.secGrpId;
      });
      return dispatch({
        type: 'roleManagement/deleteSecGrp',
        payload: {
          roleId: currentRowData.id,
          secGrpList: list
        }
      });
    }
    /**
     * 查询角色已分配的指定安全组的访问权限
     * @param {number} secGrpId - 安全组ID
     */

  }, {
    key: "fetchVisitPermission",
    value: function fetchVisitPermission(secGrpId) {
      var dispatch = this.props.dispatch;
      var currentRowData = this.state.currentRowData;
      return dispatch({
        type: 'roleManagement/querySecGrpPermissionMenus',
        roleId: currentRowData.id,
        secGrpId: secGrpId
      });
    }
    /**
     * 查询角色已分配的指定安全组的字段权限
     * @param {number} secGrpId - 安全组ID
     */

  }, {
    key: "fetchFieldPermission",
    value: function fetchFieldPermission(secGrpId) {
      var dispatch = this.props.dispatch;
      var currentRowData = this.state.currentRowData;
      dispatch({
        type: 'roleManagement/queryFieldPermission',
        payload: {
          secGrpId: secGrpId,
          roleId: currentRowData.id
        }
      });
    }
    /**
     * 查询角色已分配的指定安全组的字段配置列表
     * @param {object} params - 请求参数
     */

  }, {
    key: "fetchFieldConfigList",
    value: function fetchFieldConfigList() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var dispatch = this.props.dispatch;
      var currentRowData = this.state.currentRowData;
      return dispatch({
        type: 'roleManagement/queryFieldConfig',
        payload: _objectSpread({
          roleId: currentRowData.id
        }, params)
      });
    }
    /**
     * 查询角色已分配的指定安全组的工作台权限
     * @param {number} secGrpId - 安全组ID
     */

  }, {
    key: "fetchCardPermission",
    value: function fetchCardPermission(secGrpId) {
      var dispatch = this.props.dispatch;
      var currentRowData = this.state.currentRowData;
      dispatch({
        type: 'roleManagement/queryCardPermission',
        payload: {
          secGrpId: secGrpId,
          roleId: currentRowData.id
        }
      });
    }
    /**
     * 查询角色已分配的指定安全组的数据权限维度
     * @param {number} secGrpId - 安全组ID
     */

  }, {
    key: "fetchDataDimension",
    value: function fetchDataDimension(secGrpId) {
      var dispatch = this.props.dispatch;
      var currentRowData = this.state.currentRowData;
      dispatch({
        type: 'roleManagement/queryDataDimension',
        payload: {
          secGrpId: secGrpId,
          roleId: currentRowData.id
        }
      });
    }
    /**
     * 查询角色已分配的指定安全组的数据权限的tab页
     * @param {number} secGrpId - 安全组ID
     */

  }, {
    key: "fetchDataPermission",
    value: function fetchDataPermission(secGrpId) {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/queryDataPermissionTab',
        secGrpId: secGrpId
      });
    }
    /**
     * 屏蔽/取消屏蔽安全组权限
     * @param {object} payload - 请求数据
     */

  }, {
    key: "handleShieldPermission",
    value: function handleShieldPermission(payload) {
      var callBack = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;

      var shieldFlag = payload.shieldFlag,
          rest = _objectWithoutProperties(payload, _excluded);

      var type = "roleManagement/".concat(shieldFlag ? 'cancelShieldSecGrpPermission' : 'shieldSecGrpPermission');
      dispatch({
        type: type,
        payload: rest
      }).then(function (res) {
        if (res) {
          callBack();
        }
      });
    }
    /**
     * 清空安全组侧滑的数据
     */

  }, {
    key: "resetSecGrp",
    value: function resetSecGrp() {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          secGrpList: [],
          // 安全组列表
          secGrpPagination: {},
          // 安全组分页
          secGrpAddModalList: [],
          // 可分配安全组列表
          secGrpAddModalPagination: {},
          // 可分配安全组分页
          secGrpFieldPermissionList: [],
          // 安全组字段权限列表
          secGrpFieldPermissionPagination: {},
          // 安全组字段权限分页
          secGrpCardList: [],
          // 安全组工作台权限列表
          secGrpCardPagination: {},
          // 安全组工作台权限分页
          secGrpDimensionList: [],
          // 安全组数据权限维度列表
          secGrpDimensionPagination: {},
          // 安全组数据权限维度分页
          secGrpDataPermissionTabList: [] // 安全组数据权限tab页

        }
      });
    }
    /**
     * 清空安全组权限数据
     */

  }, {
    key: "resetPermissions",
    value: function resetPermissions() {
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          secGrpFieldPermissionList: [],
          // 安全组字段权限列表
          secGrpFieldPermissionPagination: {},
          // 安全组字段权限分页
          secGrpCardList: [],
          // 安全组工作台权限列表
          secGrpCardPagination: {},
          // 安全组工作台权限分页
          secGrpDimensionList: [],
          // 安全组数据权限维度列表
          secGrpDimensionPagination: {},
          // 安全组数据权限维度分页
          secGrpDataPermissionTabList: [] // 安全组数据权限tab页

        }
      });
    }
    /**
     * handleSaveMembers - 保存角色成员钩子函数
     * @param {object} data - 表单数据
     * @param {!number} isEdit - 后台关键参数
     * @param {!function} cb - 异步事件函数
     */

  }, {
    key: "handleSaveMembers",
    value: function handleSaveMembers(data) {
      var _this12 = this;

      var isEdit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var cb = arguments.length > 2 ? arguments[2] : undefined;
      var _this$props9 = this.props,
          dispatch = _this$props9.dispatch,
          list = _this$props9.roleManagement.list;
      var _this$queryForm$getFi6 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi6 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi6;
      dispatch({
        type: 'roleManagement/saveMembers',
        data: data,
        isEdit: isEdit
      }).then(function (res) {
        if (res) {
          _this12.fetchList(_objectSpread({
            page: list.pagination
          }, getFieldsValue()) || {});

          if (_isFunction(cb)) {
            cb();
          }
        }
      });
    }
    /**
     * handleDeleteMembers - 删除角色成员钩子函数
     * @param {object} data - 表单数据
     * @param {!function} cb - 异步事件函数
     */

  }, {
    key: "handleDeleteMembers",
    value: function handleDeleteMembers(data) {
      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/deleteMembers',
        data: data
      }).then(function (res) {
        if (res && res.failed) {
          notification.error({
            description: res.message
          });
        } else {
          cb();
        }
      });
    }
    /**
     * handleDeleteMembers - 删除角色成员钩子函数
     * @param {object} data - 删除的用户
     */

  }, {
    key: "handleDeleteMember",
    value: function () {
      var _handleDeleteMember = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
        var dispatch, res;
        return _regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                dispatch = this.props.dispatch;
                _context.next = 3;
                return dispatch({
                  type: 'roleManagement/deleteMembers',
                  data: data
                });

              case 3:
                res = _context.sent;
                return _context.abrupt("return", res);

              case 5:
              case "end":
                return _context.stop();
            }
          }
        }, _callee, this);
      }));

      function handleDeleteMember(_x) {
        return _handleDeleteMember.apply(this, arguments);
      }

      return handleDeleteMember;
    }()
  }, {
    key: "showModal",
    value: function showModal(record) {
      var _this13 = this;

      var dispatch = this.props.dispatch;
      var roleId = record.id,
          tenantId = record.tenantId;
      this.setState({
        selectedRoleId: roleId,
        tenantId: tenantId
      }, function () {
        _this13.handleModalVisible(true);

        dispatch({
          type: 'roleManagement/queryRoleAuthType'
        });
        dispatch({
          type: 'roleManagement/queryRoleAuth',
          payload: {
            roleId: roleId,
            body: {
              page: 0,
              size: 10
            }
          }
        });
      });
    }
  }, {
    key: "hideModal",
    value: function hideModal(func) {
      var _this$props$saving = this.props.saving,
          saving = _this$props$saving === void 0 ? false : _this$props$saving;

      if (!saving) {
        this.handleModalVisible(false);

        if (func) {
          func();
        }
      }
    }
  }, {
    key: "handleModalVisible",
    value: function handleModalVisible(flag) {
      this.setState({
        modalVisible: !!flag
      });
    }
  }, {
    key: "queryAuthDocType",
    value: function queryAuthDocType() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
        page: 0,
        size: 10
      };
      var dispatch = this.props.dispatch;
      var roleId = this.state.selectedRoleId;
      dispatch({
        type: 'roleManagement/queryRoleAuth',
        payload: {
          roleId: roleId,
          body: params
        }
      });
    }
  }, {
    key: "saveAuthDocType",
    value: function saveAuthDocType(data, func) {
      var _this14 = this;

      var dispatch = this.props.dispatch;
      var roleId = this.state.selectedRoleId;

      if (!_isEmpty(data)) {
        dispatch({
          type: 'roleManagement/saveRoleAuth',
          payload: {
            roleId: roleId,
            body: data
          }
        }).then(function (res) {
          if (_isArray(res)) {
            notification.success();

            _this14.hideModal(func);
          } else {
            notification.error();
          }
        });
      } else {
        this.hideModal();
      }
    }
  }, {
    key: "deleteAuthDocType",
    value: function deleteAuthDocType(data) {
      var _this15 = this;

      var dispatch = this.props.dispatch;
      var roleId = this.state.selectedRoleId;
      dispatch({
        type: 'roleManagement/deleteRoleAuth',
        payload: {
          roleId: roleId,
          body: data
        }
      }).then(function () {
        _this15.queryAuthDocType();
      });
    }
  }, {
    key: "onListChange",
    value: function onListChange(page) {
      var _this$queryForm$getFi7 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi7 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi7;
      this.fetchList(_objectSpread({
        page: page
      }, getFieldsValue()));
    } // 角色分配卡片

  }, {
    key: "fetchRoleCards",
    value: function fetchRoleCards(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/fetchRoleCards',
        payload: payload
      });
    }
  }, {
    key: "removeRoleCards",
    value: function removeRoleCards(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/removeRoleCards',
        payload: payload
      });
    }
    /**
     * 打开角色分配租户模态框
     */

  }, {
    key: "openRoleAssignCardsEditModal",
    value: function openRoleAssignCardsEditModal(editRecord) {
      this.setState({
        roleAssignCardsEditModalProps: {
          role: editRecord,
          visible: true
        }
      });
    }
    /**
     * 进入角色字段权限维护 界面
     */

  }, {
    key: "gotoFieldPermission",
    value: function gotoFieldPermission(editRecord) {
      var dispatch = this.props.dispatch;
      deleteCache('/ciam/role/api/list');
      deleteCache('/ciam/role/api/search-form');
      dispatch(routerRedux.push({
        pathname: "/ciam/role/api/".concat(editRecord.id)
      }));
    }
  }, {
    key: "hiddenRoleAssignCardsEditModal",
    value: function hiddenRoleAssignCardsEditModal() {
      this.setState({
        roleAssignCardsEditModalProps: {
          role: {},
          visible: false
        }
      });
    } // 角色分配卡片 模态框 确认

  }, {
    key: "handleRoleAssignOk",
    value: function handleRoleAssignOk(payload) {
      var _this16 = this;

      this.handleCardOk(payload).then(function () {
        // 成功 关闭模态框
        _this16.hiddenRoleAssignCardsEditModal();
      });
    }
  }, {
    key: "handleCardOk",
    value: function handleCardOk(payload) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'roleManagement/saveRoleCards',
        payload: payload
      }).then(function (res) {
        if (res) {
          notification.success();
        }
      });
    } // 角色分配卡片 模态框 取消

  }, {
    key: "handleRoleAssignCancel",
    value: function handleRoleAssignCancel() {
      this.hiddenRoleAssignCardsEditModal();
    }
    /**
     * 批量删除客户端
     * @param {*} selectedRows
     */

  }, {
    key: "handleDeleteClient",
    value: function handleDeleteClient(data) {
      var _this17 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/deleteMembers',
        data: data
      }).then(function (res) {
        _this17.handleQueryClients();

        if (res && res.failed) {
          notification.error({
            description: res.message
          });
        } else {
          cb();
          notification.success();
        }
      });
    }
    /**
     * 新建客户端行
     */

  }, {
    key: "handleAddClient",
    value: function handleAddClient() {
      var _this$props10 = this.props,
          dispatch = _this$props10.dispatch,
          _this$props10$roleMan = _this$props10.roleManagement,
          _this$props10$roleMan2 = _this$props10$roleMan.clientList,
          clientList = _this$props10$roleMan2 === void 0 ? [] : _this$props10$roleMan2,
          _this$props10$roleMan3 = _this$props10$roleMan.clientPagination,
          clientPagination = _this$props10$roleMan3 === void 0 ? {} : _this$props10$roleMan3;
      var currentRowData = this.state.currentRowData;
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          clientList: [{
            _status: 'create',
            id: "create-".concat(uuidv4()),
            tenantName: '',
            assignLevel: currentRowData.assignLevel,
            assignLevelMeaning: currentRowData.assignLevelMeaning,
            assignLevelValueMeaning: currentRowData.assignLevelValueMeaning
          }].concat(_toConsumableArray(clientList)),
          clientPagination: addItemToPagination(clientList.length, clientPagination)
        }
      });
    }
    /**
     * 删除新建行
     * @param {*} record
     */

  }, {
    key: "handleDeleteRow",
    value: function handleDeleteRow(record) {
      var _this$props11 = this.props,
          dispatch = _this$props11.dispatch,
          _this$props11$roleMan = _this$props11.roleManagement,
          _this$props11$roleMan2 = _this$props11$roleMan.clientList,
          clientList = _this$props11$roleMan2 === void 0 ? [] : _this$props11$roleMan2,
          _this$props11$roleMan3 = _this$props11$roleMan.clientPagination,
          clientPagination = _this$props11$roleMan3 === void 0 ? {} : _this$props11$roleMan3;
      var newList = clientList.filter(function (item) {
        return item.id !== record.id;
      });
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          clientList: newList,
          clientPagination: delItemToPagination(clientList.length, clientPagination)
        }
      });
    }
    /**
     * 编辑行数据
     * @param {*} record
     * @param {*} flag
     */

  }, {
    key: "handleEditRow",
    value: function handleEditRow(record, flag) {
      var _this$props12 = this.props,
          dispatch = _this$props12.dispatch,
          _this$props12$roleMan = _this$props12.roleManagement.clientList,
          clientList = _this$props12$roleMan === void 0 ? [] : _this$props12$roleMan;
      var newList = clientList.map(function (item) {
        if (record.id === item.id) {
          return _objectSpread(_objectSpread({}, item), {}, {
            _status: flag ? 'update' : ''
          });
        }

        return item;
      });
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          clientList: newList
        }
      });
    }
    /**
     * 取消编辑行数据
     * @param {*} record
     * @param {*} flag
     */

  }, {
    key: "handleCancelEdit",
    value: function handleCancelEdit(record, flag) {
      var _this$props13 = this.props,
          dispatch = _this$props13.dispatch,
          _this$props13$roleMan = _this$props13.roleManagement.clientList,
          clientList = _this$props13$roleMan === void 0 ? [] : _this$props13$roleMan;
      var newList = clientList.map(function (item) {
        if (record.id === item.id) {
          return _objectSpread(_objectSpread({}, item), {}, {
            _status: flag ? 'update' : ''
          });
        }

        return item;
      });
      dispatch({
        type: 'roleManagement/updateState',
        payload: {
          clientList: newList
        }
      });
    }
    /**
     * 保存客户端
     * @param {*} params
     */

  }, {
    key: "handleSaveClient",
    value: function handleSaveClient(data) {
      var _this18 = this;

      var isEdit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var cb = arguments.length > 2 ? arguments[2] : undefined;
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'roleManagement/saveMembers',
        data: data,
        isEdit: isEdit
      }).then(function (res) {
        if (res) {
          notification.success();

          _this18.handleQueryClients();

          _this18.setClientsDrawerVisible(false);

          if (_isFunction(cb)) {
            cb();
          }
        }
      });
    }
    /**
     * 分配客户端分页切换
     * @param {*} pagination
     */

  }, {
    key: "handleClientPageChange",
    value: function handleClientPageChange() {
      var pagination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var fieldsValue = arguments.length > 1 ? arguments[1] : undefined;
      // 分配客户端分页切换
      this.handleQueryClients(_objectSpread({
        page: pagination
      }, fieldsValue));
    }
    /**
     * 分配客户端查询表单
     * @param {*} fieldsValue
     */

  }, {
    key: "handleClientSearch",
    value: function handleClientSearch(fieldsValue) {
      this.handleQueryClients(fieldsValue);
    }
  }, {
    key: "handleAddCard",
    value: function handleAddCard() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _this$props14 = this.props,
          dispatch = _this$props14.dispatch,
          _this$props14$roleMan = _this$props14.roleManagement.cardListPagination,
          cardListPagination = _this$props14$roleMan === void 0 ? {} : _this$props14$roleMan;
      dispatch({
        type: 'roleManagement/queryRoleCard',
        payload: _objectSpread({
          page: cardListPagination
        }, params)
      });
    }
  }, {
    key: "handleCardAddTableChange",
    value: function handleCardAddTableChange() {
      var pagination = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var fieldsValue = arguments.length > 1 ? arguments[1] : undefined;
      this.handleAddCard(_objectSpread({
        page: pagination
      }, fieldsValue));
    }
  }, {
    key: "handleChangeLov",
    value: function handleChangeLov(_) {
      var _this19 = this;

      var record = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var _this$queryForm$getFi8 = this.queryForm.getFieldsValue,
          getFieldsValue = _this$queryForm$getFi8 === void 0 ? function (e) {
        return e;
      } : _this$queryForm$getFi8;
      this.setState({
        record: record,
        createDisabled: !record.adminFlag
      }, function () {
        _this19.fetchList(_objectSpread({}, getFieldsValue()));
      });
    }
    /**
     * render
     * @return React.element
     */

  }, {
    key: "render",
    value: function render() {
      var _this20 = this;

      var _this$state$tenantsLo = this.state.tenantsLoaded,
          tenantsLoaded = _this$state$tenantsLo === void 0 ? false : _this$state$tenantsLo;
      var isTenant = isTenantRoleLevel();

      if (isTenant && !tenantsLoaded) {
        return /*#__PURE__*/React.createElement("div", {
          className: styles['ciam-role-list']
        }, /*#__PURE__*/React.createElement(Header, {
          title: intl.get("ciam.roleManagement.view.title.listHeader").d('角色管理')
        }), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(Spin, {
          spinning: true
        })));
      }

      var _this$props15 = this.props,
          form = _this$props15.form,
          path = _this$props15.match.path,
          _this$props15$roleMan = _this$props15.roleManagement,
          roleManagement = _this$props15$roleMan === void 0 ? {} : _this$props15$roleMan,
          tenantRoleLevel = _this$props15.tenantRoleLevel,
          _this$props15$saveAut = _this$props15.saveAuthLoading,
          saveAuthLoading = _this$props15$saveAut === void 0 ? false : _this$props15$saveAut,
          _this$props15$roleAut = _this$props15.roleAuthLoading,
          roleAuthLoading = _this$props15$roleAut === void 0 ? false : _this$props15$roleAut,
          _this$props15$queryLi = _this$props15.queryListLoading,
          queryListLoading = _this$props15$queryLi === void 0 ? false : _this$props15$queryLi,
          _this$props15$saveMem = _this$props15.saveMembersLoading,
          saveMembersLoading = _this$props15$saveMem === void 0 ? false : _this$props15$saveMem,
          _this$props15$queryMe = _this$props15.queryMemberRolesClientsLoading,
          queryMemberRolesClientsLoading = _this$props15$queryMe === void 0 ? false : _this$props15$queryMe,
          _this$props15$deleteM = _this$props15.deleteMembersLoading,
          deleteMembersLoading = _this$props15$deleteM === void 0 ? false : _this$props15$deleteM,
          _this$props15$queryMe2 = _this$props15.queryMemberRolesUsersLoading,
          queryMemberRolesUsersLoading = _this$props15$queryMe2 === void 0 ? false : _this$props15$queryMe2,
          _this$props15$queryDe = _this$props15.queryDetailFormLoading,
          queryDetailFormLoading = _this$props15$queryDe === void 0 ? false : _this$props15$queryDe,
          _this$props15$queryAd = _this$props15.queryAdminRoleLoading,
          queryAdminRoleLoading = _this$props15$queryAd === void 0 ? false : _this$props15$queryAd,
          _this$props15$saveRol = _this$props15.saveRoleLoading,
          saveRoleLoading = _this$props15$saveRol === void 0 ? false : _this$props15$saveRol,
          _this$props15$createR = _this$props15.createRoleLoading,
          createRoleLoading = _this$props15$createR === void 0 ? false : _this$props15$createR,
          _this$props15$copyRol = _this$props15.copyRoleLoading,
          copyRoleLoading = _this$props15$copyRol === void 0 ? false : _this$props15$copyRol,
          _this$props15$inherit = _this$props15.inheritRoleLoading,
          inheritRoleLoading = _this$props15$inherit === void 0 ? false : _this$props15$inherit,
          _this$props15$queryPe = _this$props15.queryPermissionMenusLoading,
          queryPermissionMenusLoading = _this$props15$queryPe === void 0 ? false : _this$props15$queryPe,
          _this$props15$batchAs = _this$props15.batchAssignPermissionSetsLoading,
          batchAssignPermissionSetsLoading = _this$props15$batchAs === void 0 ? false : _this$props15$batchAs,
          _this$props15$batchUn = _this$props15.batchUnassignPermissionSetsLoading,
          batchUnassignPermissionSetsLoading = _this$props15$batchUn === void 0 ? false : _this$props15$batchUn,
          _this$props15$fetchRo = _this$props15.fetchRoleCardsLoading,
          fetchRoleCardsLoading = _this$props15$fetchRo === void 0 ? false : _this$props15$fetchRo,
          _this$props15$removeR = _this$props15.removeRoleCardsLoading,
          removeRoleCardsLoading = _this$props15$removeR === void 0 ? false : _this$props15$removeR,
          _this$props15$saveRol2 = _this$props15.saveRoleCardsLoading,
          saveRoleCardsLoading = _this$props15$saveRol2 === void 0 ? false : _this$props15$saveRol2,
          fetchTabListLoading = _this$props15.fetchTabListLoading,
          updateCompanyLoading = _this$props15.updateCompanyLoading,
          fetchCompanyLoading = _this$props15.fetchCompanyLoading,
          refreshCompanyLoading = _this$props15.refreshCompanyLoading,
          addPurOrgLoading = _this$props15.addPurOrgLoading,
          fetchPurOrgLoading = _this$props15.fetchPurOrgLoading,
          fetchModalPurOrgLoading = _this$props15.fetchModalPurOrgLoading,
          addPuragentLoading = _this$props15.addPuragentLoading,
          fetchPuragentLoading = _this$props15.fetchPuragentLoading,
          fetchModalPuragentLoading = _this$props15.fetchModalPuragentLoading,
          addValueListLoading = _this$props15.addValueListLoading,
          fetchValueListLoading = _this$props15.fetchValueListLoading,
          fetchModalValueListLoading = _this$props15.fetchModalValueListLoading,
          queryRoleCardLoading = _this$props15.queryRoleCardLoading,
          addLovViewLoading = _this$props15.addLovViewLoading,
          fetchLovViewLoading = _this$props15.fetchLovViewLoading,
          fetchModalLovViewLoading = _this$props15.fetchModalLovViewLoading,
          addDataSourceLoading = _this$props15.addDataSourceLoading,
          fetchDataSourceLoading = _this$props15.fetchDataSourceLoading,
          fetchModalDataSourceLoading = _this$props15.fetchModalDataSourceLoading,
          addDataGroupLoading = _this$props15.addDataGroupLoading,
          fetchDataGroupLoading = _this$props15.fetchDataGroupLoading,
          fetchModalDataGroupLoading = _this$props15.fetchModalDataGroupLoading,
          querySecGrpLoading = _this$props15.querySecGrpLoading,
          queryAssignableSecGrpLoading = _this$props15.queryAssignableSecGrpLoading,
          assignSecGrpLoading = _this$props15.assignSecGrpLoading,
          deleteSecGrpLoading = _this$props15.deleteSecGrpLoading,
          queryVisitPermissionLoading = _this$props15.queryVisitPermissionLoading,
          queryFieldPermissionLoading = _this$props15.queryFieldPermissionLoading,
          queryFieldConfigLoading = _this$props15.queryFieldConfigLoading,
          queryCardLoading = _this$props15.queryCardLoading,
          queryDataDimensionLoading = _this$props15.queryDataDimensionLoading,
          shieldLoading = _this$props15.shieldLoading,
          queryDataPermissionTabLoading = _this$props15.queryDataPermissionTabLoading,
          _this$props15$roleDat = _this$props15.roleDataAuthorityCompany,
          roleDataAuthorityCompany = _this$props15$roleDat === void 0 ? {} : _this$props15$roleDat,
          _this$props15$roleDat2 = _this$props15.roleDataAuthorityPurorg,
          roleDataAuthorityPurorg = _this$props15$roleDat2 === void 0 ? {} : _this$props15$roleDat2,
          _this$props15$roleDat3 = _this$props15.roleDataAuthorityManagement,
          roleDataAuthorityManagement = _this$props15$roleDat3 === void 0 ? {} : _this$props15$roleDat3,
          _this$props15$roleDat4 = _this$props15.roleDataAuthorityPuragent,
          roleDataAuthorityPuragent = _this$props15$roleDat4 === void 0 ? {} : _this$props15$roleDat4,
          _this$props15$roleDat5 = _this$props15.roleDataAuthorityLovView,
          roleDataAuthorityLovView = _this$props15$roleDat5 === void 0 ? {} : _this$props15$roleDat5,
          _this$props15$roleDat6 = _this$props15.roleDataAuthorityDataSource,
          roleDataAuthorityDataSource = _this$props15$roleDat6 === void 0 ? {} : _this$props15$roleDat6,
          _this$props15$roleDat7 = _this$props15.roleDataAuthorityValueList,
          roleDataAuthorityValueList = _this$props15$roleDat7 === void 0 ? {} : _this$props15$roleDat7,
          _this$props15$roleDat8 = _this$props15.roleDataAuthorityDataGroup,
          roleDataAuthorityDataGroup = _this$props15$roleDat8 === void 0 ? {} : _this$props15$roleDat8,
          _this$props15$roleMan2 = _this$props15.roleManagement,
          _this$props15$roleMan3 = _this$props15$roleMan2.clientList,
          clientList = _this$props15$roleMan3 === void 0 ? [] : _this$props15$roleMan3,
          _this$props15$roleMan4 = _this$props15$roleMan2.userTypeList,
          userTypeList = _this$props15$roleMan4 === void 0 ? [] : _this$props15$roleMan4,
          _this$props15$roleMan5 = _this$props15$roleMan2.cardList,
          cardList = _this$props15$roleMan5 === void 0 ? [] : _this$props15$roleMan5,
          _this$props15$roleMan6 = _this$props15$roleMan2.labelList,
          labelList = _this$props15$roleMan6 === void 0 ? [] : _this$props15$roleMan6,
          _this$props15$roleMan7 = _this$props15$roleMan2.cardListPagination,
          cardListPagination = _this$props15$roleMan7 === void 0 ? {} : _this$props15$roleMan7,
          _this$props15$roleMan8 = _this$props15$roleMan2.secGrpList,
          secGrpList = _this$props15$roleMan8 === void 0 ? [] : _this$props15$roleMan8,
          _this$props15$roleMan9 = _this$props15$roleMan2.secGrpPagination,
          secGrpPagination = _this$props15$roleMan9 === void 0 ? {} : _this$props15$roleMan9,
          _this$props15$roleMan10 = _this$props15$roleMan2.secGrpAddModalList,
          secGrpAddModalList = _this$props15$roleMan10 === void 0 ? [] : _this$props15$roleMan10,
          _this$props15$roleMan11 = _this$props15$roleMan2.secGrpAddModalPagination,
          secGrpAddModalPagination = _this$props15$roleMan11 === void 0 ? {} : _this$props15$roleMan11,
          _this$props15$roleMan12 = _this$props15$roleMan2.secGrpFieldPermissionList,
          secGrpFieldPermissionList = _this$props15$roleMan12 === void 0 ? [] : _this$props15$roleMan12,
          _this$props15$roleMan13 = _this$props15$roleMan2.secGrpFieldPermissionPagination,
          secGrpFieldPermissionPagination = _this$props15$roleMan13 === void 0 ? {} : _this$props15$roleMan13,
          _this$props15$roleMan14 = _this$props15$roleMan2.secGrpCardList,
          secGrpCardList = _this$props15$roleMan14 === void 0 ? [] : _this$props15$roleMan14,
          _this$props15$roleMan15 = _this$props15$roleMan2.secGrpCardPagination,
          secGrpCardPagination = _this$props15$roleMan15 === void 0 ? {} : _this$props15$roleMan15,
          _this$props15$roleMan16 = _this$props15$roleMan2.secGrpDimensionList,
          secGrpDimensionList = _this$props15$roleMan16 === void 0 ? [] : _this$props15$roleMan16,
          _this$props15$roleMan17 = _this$props15$roleMan2.secGrpDimensionPagination,
          secGrpDimensionPagination = _this$props15$roleMan17 === void 0 ? {} : _this$props15$roleMan17,
          _this$props15$roleMan18 = _this$props15$roleMan2.secGrpDataPermissionTabList,
          secGrpDataPermissionTabList = _this$props15$roleMan18 === void 0 ? [] : _this$props15$roleMan18;
      var _this$state = this.state,
          membersDrawerVisible = _this$state.membersDrawerVisible,
          clientsDrawerVisible = _this$state.clientsDrawerVisible,
          secGrpDrawerVisible = _this$state.secGrpDrawerVisible,
          membersDrawerDataSource = _this$state.membersDrawerDataSource,
          membersDrawerPagination = _this$state.membersDrawerPagination,
          currentRowData = _this$state.currentRowData,
          selectedRoleId = _this$state.selectedRoleId,
          detailDrawerVisible = _this$state.detailDrawerVisible,
          actionType = _this$state.actionType,
          inheritedRoleName = _this$state.inheritedRoleName,
          copyFormId = _this$state.copyFormId,
          inheritFormId = _this$state.inheritFormId,
          permissionDrawerVisible = _this$state.permissionDrawerVisible,
          currentRole = _this$state.currentRole,
          expandedRowKeys = _this$state.expandedRowKeys,
          roleAssignCardsEditModalProps = _this$state.roleAssignCardsEditModalProps,
          tenantsMulti = _this$state.tenantsMulti,
          tenantId = _this$state.tenantId,
          createDisabled = _this$state.createDisabled,
          record = _this$state.record;
      var code = roleManagement.code,
          _roleManagement$searc = roleManagement.searchLabels,
          searchLabels = _roleManagement$searc === void 0 ? [] : _roleManagement$searc,
          _roleManagement$list2 = roleManagement.list,
          list = _roleManagement$list2 === void 0 ? {} : _roleManagement$list2,
          _roleManagement$roleA = roleManagement.roleAuth,
          roleAuth = _roleManagement$roleA === void 0 ? {} : _roleManagement$roleA,
          _roleManagement$roleA2 = roleManagement.roleAuthScopeCode,
          roleAuthScopeCode = _roleManagement$roleA2 === void 0 ? [] : _roleManagement$roleA2,
          _roleManagement$roleA3 = roleManagement.roleAuthScopeTypeCode,
          roleAuthScopeTypeCode = _roleManagement$roleA3 === void 0 ? [] : _roleManagement$roleA3,
          _roleManagement$clien = roleManagement.clientPagination,
          clientPagination = _roleManagement$clien === void 0 ? {} : _roleManagement$clien;
      var organizationId = getCurrentOrganizationId();
      var searchProps = {
        ref: function ref(node) {
          _this20.queryForm = node;
        },
        handleQueryList: this.fetchList,
        code: code['CIAM.ROLE_SOURCE'] || [],
        roleLevel: code['CIAM.RESOURCE_LEVEL'] || [],
        loading: queryListLoading,
        tenantRoleLevel: tenantRoleLevel,
        searchLabels: searchLabels
      };
      var listProps = {
        dataSource: list.dataSource || [],
        pagination: list.pagination || {},
        loading: queryListLoading,
        code: code['CIAM.ROLE_SOURCE'],
        handleAction: this.handleAction.bind(this),
        onExpand: this.onExpand.bind(this),
        expandedRowKeys: expandedRowKeys,
        currentRole: currentRole,
        organizationId: organizationId,
        tenantRoleLevel: tenantRoleLevel,
        onListChange: this.onListChange,
        tenantsMulti: tenantsMulti,
        path: path,
        record: record
      };
      var membersDrawerProps = {
        path: path,
        tenantRoleLevel: tenantRoleLevel,
        visible: membersDrawerVisible,
        title: intl.get("ciam.roleManagement.view.title.members").d('分配用户'),
        contentTitle: intl.get('ciam.roleManagement.view.title.content.members', {
          name: currentRowData.name
        }).d("\u7ED9\"".concat(currentRowData.name, "\"\u5206\u914D\u7528\u6237")),
        roleDatasource: currentRowData,
        userTypeList: userTypeList,
        resourceLevel: code['CIAM.RESOURCE_LEVEL'],
        processing: {
          save: saveMembersLoading,
          delete: deleteMembersLoading,
          query: queryMemberRolesUsersLoading
        },
        handleSave: this.handleSaveMembers.bind(this),
        close: this.closeMembersDrawer.bind(this),
        handleFetchData: this.handleQueryMembers.bind(this),
        handleFetchHrunitsTree: this.fetchHrunitsTree.bind(this),
        handleSetDataSource: this.setMembersDrawerDataSource.bind(this),
        handleDelete: this.handleDeleteMembers.bind(this),
        onDeleteMember: this.handleDeleteMember,
        dataSource: membersDrawerDataSource,
        pagination: membersDrawerPagination
      };
      var clientsDrawerProps = {
        path: path,
        tenantRoleLevel: tenantRoleLevel,
        visible: clientsDrawerVisible,
        title: intl.get("ciam.roleManagement.view.title.clients").d('分配客户端'),
        close: this.closeClientsDrawer.bind(this),
        handleFetchData: this.handleQueryClients.bind(this),
        roleDatasource: currentRowData,
        clientList: clientList,
        clientPagination: clientPagination,
        saveLoading: saveMembersLoading,
        deleteLoading: deleteMembersLoading,
        queryLoading: queryMemberRolesClientsLoading,
        onEdit: this.handleEditRow,
        onCancelEdit: this.handleCancelEdit,
        onDeleteClient: this.handleDeleteClient,
        onAddClient: this.handleAddClient,
        onDeleteRow: this.handleDeleteRow,
        onSave: this.handleSaveClient,
        onClientPageChange: this.handleClientPageChange,
        onFormSearch: this.handleClientSearch
      };
      var secGrpDrawerProps = {
        path: path,
        roleId: currentRowData.id,
        tenantId: tenantId,
        visible: secGrpDrawerVisible,
        secGrpList: secGrpList,
        secGrpPagination: secGrpPagination,
        secGrpAddModalList: secGrpAddModalList,
        secGrpAddModalPagination: secGrpAddModalPagination,
        secGrpFieldPermissionList: secGrpFieldPermissionList,
        secGrpFieldPermissionPagination: secGrpFieldPermissionPagination,
        secGrpCardList: secGrpCardList,
        secGrpCardPagination: secGrpCardPagination,
        secGrpDimensionList: secGrpDimensionList,
        secGrpDimensionPagination: secGrpDimensionPagination,
        secGrpDataPermissionTabList: secGrpDataPermissionTabList,
        onCancel: this.closeSecGrpDrawer,
        onFormSearch: this.handleSecGrpSearch,
        onAssignSecGrp: this.handleAssignSecGrp,
        onDelete: this.handleDeleteSecGrp,
        onSecGrpPageChange: this.handleSecGrpPageChange,
        onFetchVisitPermission: this.fetchVisitPermission,
        onFetchFieldPermission: this.fetchFieldPermission,
        onFetchFieldConfigList: this.fetchFieldConfigList,
        onFetchCardPermission: this.fetchCardPermission,
        onFetchDataDimension: this.fetchDataDimension,
        onFetchDataPermission: this.fetchDataPermission,
        onShield: this.handleShieldPermission,
        fetchAssignableSecGrp: this.fetchAssignableSecGrp,
        queryLoading: querySecGrpLoading,
        deleteLoading: deleteSecGrpLoading,
        queryModalLoading: queryAssignableSecGrpLoading,
        saveModalLoading: assignSecGrpLoading,
        queryVisitPermissionLoading: queryVisitPermissionLoading,
        queryFieldPermissionLoading: queryFieldPermissionLoading,
        queryFieldConfigLoading: queryFieldConfigLoading,
        queryCardLoading: queryCardLoading,
        queryDataDimensionLoading: queryDataDimensionLoading,
        shieldLoading: shieldLoading,
        queryDataPermissionTabLoading: queryDataPermissionTabLoading,
        onResetPermissions: this.resetPermissions
      };
      var detailDrawerProps = {
        path: path,
        visible: detailDrawerVisible,
        actionType: actionType,
        organizationId: currentRole.tenantId,
        organizationName: currentRole.tenantName,
        roleId: currentRowData.id,
        labelList: labelList,
        processing: {
          query: queryDetailFormLoading,
          queryAdminRole: queryAdminRoleLoading,
          save: saveRoleLoading,
          create: createRoleLoading,
          copy: copyRoleLoading,
          inherit: inheritRoleLoading
        },
        close: this.closeDetail.bind(this),
        fetchDataSource: this.fetchDetailForm.bind(this),
        fetchAdminRole: this.fetchAdminRole.bind(this),
        save: this.saveRoleDetail.bind(this),
        create: this.createRole.bind(this),
        copy: this.copyRole.bind(this),
        inherit: this.inheritRole.bind(this),
        queryLabel: this.queryLabel.bind(this),
        inheritedRoleName: inheritedRoleName,
        roleSourceCode: code['CIAM.ROLE_SOURCE'] || [],
        copyFormId: copyFormId,
        inheritFormId: inheritFormId,
        currentRowData: currentRowData,
        tenantRoleLevel: tenantRoleLevel
      };
      var permissionDrawerProps = {
        tenantRoleLevel: tenantRoleLevel,
        visible: permissionDrawerVisible,
        close: this.closePermission.bind(this),
        roleName: currentRowData.name,
        roleId: currentRowData.id,
        processing: {
          query: queryPermissionMenusLoading,
          batchAssignPermissionSets: batchAssignPermissionSetsLoading,
          batchUnassignPermissionSets: batchUnassignPermissionSetsLoading
        },
        fetchDataSource: this.fetchPermissionMenus.bind(this),
        batchAssignPermissionSets: this.batchAssignPermissionSets.bind(this),
        batchUnassignPermissionSets: this.batchUnassignPermissionSets.bind(this)
      }; // 工作台配置的属性

      var roleAssignProps = _objectSpread(_objectSpread({
        path: path
      }, roleAssignCardsEditModalProps), {}, {
        tenantRoleLevel: tenantRoleLevel,
        onFetchRoleCards: this.fetchRoleCards,
        onRemoveRoleCards: this.removeRoleCards,
        queryRoleCardLoading: queryRoleCardLoading,
        onOk: this.handleRoleAssignOk,
        onAdd: this.handleCardOk,
        onCancel: this.handleRoleAssignCancel,
        onAddCard: this.handleAddCard,
        loading: {
          fetchRoleCards: fetchRoleCardsLoading,
          removeRoleCards: removeRoleCardsLoading,
          saveRoleCards: saveRoleCardsLoading
        },
        cardListPagination: cardListPagination,
        cardList: cardList,
        cardTableChange: this.handleCardAddTableChange,
        onFormSearch: this.handleAddCard
      });

      var authDataProps = {
        roleDataAuthorityCompany: roleDataAuthorityCompany,
        roleDataAuthorityPurorg: roleDataAuthorityPurorg,
        roleDataAuthorityManagement: roleDataAuthorityManagement,
        roleDataAuthorityPuragent: roleDataAuthorityPuragent,
        roleDataAuthorityLovView: roleDataAuthorityLovView,
        roleDataAuthorityDataSource: roleDataAuthorityDataSource,
        roleDataAuthorityValueList: roleDataAuthorityValueList,
        roleDataAuthorityDataGroup: roleDataAuthorityDataGroup,
        fetchTabListLoading: fetchTabListLoading,
        // 公司 loading
        updateCompanyLoading: updateCompanyLoading,
        fetchCompanyLoading: fetchCompanyLoading,
        refreshCompanyLoading: refreshCompanyLoading,
        // 采购组织
        addPurOrgLoading: addPurOrgLoading,
        fetchPurOrgLoading: fetchPurOrgLoading,
        fetchModalPurOrgLoading: fetchModalPurOrgLoading,
        // 采购员
        addPuragentLoading: addPuragentLoading,
        fetchPuragentLoading: fetchPuragentLoading,
        fetchModalPuragentLoading: fetchModalPuragentLoading,
        // 值集
        addValueListLoading: addValueListLoading,
        fetchValueListLoading: fetchValueListLoading,
        fetchModalValueListLoading: fetchModalValueListLoading,
        // 值集视图
        addLovViewLoading: addLovViewLoading,
        fetchLovViewLoading: fetchLovViewLoading,
        fetchModalLovViewLoading: fetchModalLovViewLoading,
        // 数据源
        addDataSourceLoading: addDataSourceLoading,
        fetchDataSourceLoading: fetchDataSourceLoading,
        fetchModalDataSourceLoading: fetchModalDataSourceLoading,
        // 数据组
        addDataGroupLoading: addDataGroupLoading,
        fetchDataGroupLoading: fetchDataGroupLoading,
        fetchModalDataGroupLoading: fetchModalDataGroupLoading
      };
      return /*#__PURE__*/React.createElement("div", {
        className: styles['ciam-role-list']
      }, /*#__PURE__*/React.createElement(Header, {
        title: intl.get("ciam.roleManagement.view.title.listHeader").d('角色管理')
      }, /*#__PURE__*/React.createElement(ButtonPermission, {
        permissionList: [{
          code: "".concat(path, ".button.roleCreate"),
          type: 'button',
          meaning: '角色管理-创建角色'
        }],
        onClick: function onClick() {
          return _this20.handleAction('create', _this20.state.record);
        },
        disabled: createDisabled,
        icon: "plus",
        type: "primary"
      }, intl.get('ciam.roleManagement.view.button.roleCreate').d('创建角色')), /*#__PURE__*/React.createElement(Form.Item, Object.assign({}, formLayout, {
        label: intl.get("ciam.roleManagement.model.roleManagement.currentRole").d('当前角色'),
        style: {
          marginTop: '16px'
        }
      }), form.getFieldDecorator("currentRole", {
        initialValue: intl.get("ciam.roleManagement.view.title.selectParentLov").d('选择父级角色')
      })( /*#__PURE__*/React.createElement(Lov, {
        code: "CIAM.ASSIGNED_ROLE",
        allowClear: false,
        onChange: this.handleChangeLov,
        textValue: record.name
      })))), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement(Search, searchProps), /*#__PURE__*/React.createElement(List, listProps)), /*#__PURE__*/React.createElement(AssignMember, membersDrawerProps), /*#__PURE__*/React.createElement(ClientsDrawer, clientsDrawerProps), /*#__PURE__*/React.createElement(AssignSecGrpDrawer, secGrpDrawerProps), /*#__PURE__*/React.createElement(AuthDrawer, Object.assign({
        title: intl.get("ciam.roleManagement.view.title.editPermission").d('维护数据权限'),
        path: path,
        roleId: selectedRoleId,
        roleAuth: roleAuth,
        roleAuthScopeCode: roleAuthScopeCode,
        roleAuthScopeTypeCode: roleAuthScopeTypeCode,
        handleDelete: this.deleteAuthDocType,
        handleQuery: this.queryAuthDocType,
        saveLoading: saveAuthLoading,
        initLoading: roleAuthLoading,
        modalVisible: this.state.modalVisible,
        onOk: this.saveAuthDocType,
        onCancel: this.hideModal,
        tenantId: tenantId,
        width: 1200
      }, authDataProps)), detailDrawerVisible && /*#__PURE__*/React.createElement(DetailDrawer, detailDrawerProps), /*#__PURE__*/React.createElement(PermissionDrawer, permissionDrawerProps), /*#__PURE__*/React.createElement(RoleAssignCardsEditModal, roleAssignProps));
    }
  }]);

  return RoleManagement;
}(React.Component), (_applyDecoratedDescriptor(_class2.prototype, "fetchSearchLabels", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchSearchLabels"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "closeSecGrpDrawer", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "closeSecGrpDrawer"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleQuerySecGrps", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "handleQuerySecGrps"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSecGrpSearch", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSecGrpSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSecGrpPageChange", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSecGrpPageChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchAssignableSecGrp", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchAssignableSecGrp"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleAssignSecGrp", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "handleAssignSecGrp"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleDeleteSecGrp", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "handleDeleteSecGrp"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchVisitPermission", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchVisitPermission"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchFieldPermission", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchFieldPermission"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchFieldConfigList", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchFieldConfigList"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchCardPermission", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchCardPermission"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchDataDimension", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchDataDimension"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchDataPermission", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchDataPermission"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleShieldPermission", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "handleShieldPermission"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "resetSecGrp", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "resetSecGrp"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "resetPermissions", [_dec20], Object.getOwnPropertyDescriptor(_class2.prototype, "resetPermissions"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleDeleteMember", [_dec21], Object.getOwnPropertyDescriptor(_class2.prototype, "handleDeleteMember"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "showModal", [_dec22], Object.getOwnPropertyDescriptor(_class2.prototype, "showModal"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "hideModal", [_dec23], Object.getOwnPropertyDescriptor(_class2.prototype, "hideModal"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "queryAuthDocType", [_dec24], Object.getOwnPropertyDescriptor(_class2.prototype, "queryAuthDocType"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "saveAuthDocType", [_dec25], Object.getOwnPropertyDescriptor(_class2.prototype, "saveAuthDocType"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteAuthDocType", [_dec26], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteAuthDocType"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "onListChange", [_dec27], Object.getOwnPropertyDescriptor(_class2.prototype, "onListChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchRoleCards", [_dec28], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchRoleCards"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "removeRoleCards", [_dec29], Object.getOwnPropertyDescriptor(_class2.prototype, "removeRoleCards"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleRoleAssignOk", [_dec30], Object.getOwnPropertyDescriptor(_class2.prototype, "handleRoleAssignOk"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleCardOk", [_dec31], Object.getOwnPropertyDescriptor(_class2.prototype, "handleCardOk"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleRoleAssignCancel", [_dec32], Object.getOwnPropertyDescriptor(_class2.prototype, "handleRoleAssignCancel"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleDeleteClient", [_dec33], Object.getOwnPropertyDescriptor(_class2.prototype, "handleDeleteClient"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleAddClient", [_dec34], Object.getOwnPropertyDescriptor(_class2.prototype, "handleAddClient"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleDeleteRow", [_dec35], Object.getOwnPropertyDescriptor(_class2.prototype, "handleDeleteRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleEditRow", [Bind], Object.getOwnPropertyDescriptor(_class2.prototype, "handleEditRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleCancelEdit", [Bind], Object.getOwnPropertyDescriptor(_class2.prototype, "handleCancelEdit"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSaveClient", [Bind], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSaveClient"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleClientPageChange", [_dec36], Object.getOwnPropertyDescriptor(_class2.prototype, "handleClientPageChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleClientSearch", [_dec37], Object.getOwnPropertyDescriptor(_class2.prototype, "handleClientSearch"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleAddCard", [_dec38], Object.getOwnPropertyDescriptor(_class2.prototype, "handleAddCard"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleCardAddTableChange", [_dec39], Object.getOwnPropertyDescriptor(_class2.prototype, "handleCardAddTableChange"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleChangeLov", [_dec40], Object.getOwnPropertyDescriptor(_class2.prototype, "handleChangeLov"), _class2.prototype)), _class2)) || _class) || _class) || _class);
export { RoleManagement as default };